﻿<Page
    x:Class="BTKeypadUWP.MainPage"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:local="using:BTKeypadUWP"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    mc:Ignorable="d">

    <Page.Resources>
        <CollectionViewSource x:Name="PairedDevices"/>
    </Page.Resources>

    <Grid x:Name="Layout">
        <Grid.Background>
            <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
                <GradientStop Color="White" Offset="1"/>
                <GradientStop Color="LightCoral" Offset="0.75"/>
                <GradientStop Color="LightYellow" Offset="0.5"/>
                <GradientStop Color="LightYellow" Offset="0.25"/>
                <GradientStop Color="LightSkyBlue" Offset="0"/>
            </LinearGradientBrush>
        </Grid.Background>

        <StackPanel Orientation="Vertical">
            <TextBlock x:Name="MyTitle" HorizontalAlignment="Left" Height="23" Margin="10" TextWrapping="Wrap" Text="Universal Windows Generic Bluetooth Serial Test App " VerticalAlignment="Top" Width="800"/>
            <StackPanel Orientation="Vertical">
                <StackPanel Orientation="Horizontal">
                    <TextBlock x:Name="ID" HorizontalAlignment="Left" Height="23" Margin="10" TextWrapping="Wrap" Text="Id: " VerticalAlignment="Top" Width="28"/>
                    <TextBlock x:Name="TxtBlock_SelectedID" HorizontalAlignment="Left" Height="25" Margin="10" TextWrapping="Wrap" Text="Id" VerticalAlignment="Top" Width="956"/>
                </StackPanel>
                <StackPanel Orientation="Horizontal">
                    <TextBlock x:Name="BTName" HorizontalAlignment="Left" Height="23" Margin="10" TextWrapping="Wrap" Text="Name: " VerticalAlignment="Top" Width="50"/>
                    <TextBlock x:Name="textBlockBTName" HorizontalAlignment="Left" Height="35" Margin="10,10,0,10" TextWrapping="Wrap" Text="Name" VerticalAlignment="Top" Width="1004" ToolTipService.ToolTip=""/>
                </StackPanel>
            </StackPanel>
            <StackPanel Orientation="Horizontal" Height="72">
                <Button x:Name="buttonRefresh" Content="Refresh" HorizontalAlignment="Left" Height="49" Margin="5, 5, 5, 5" VerticalAlignment="Top" Width="75" Click="button_Click" IsEnabled="True"/>
                <Button x:Name="buttonDisconnect" Content="Disconnect" HorizontalAlignment="Left" Height="49" Margin="5, 5, 5, 5" VerticalAlignment="Top" Width="95" Click="button_Click" IsEnabled="False"/>
                <Button x:Name="buttonStopRecv_Copy" Content="Exit" HorizontalAlignment="Left" Height="49" Margin="5, 5, 5, 5" VerticalAlignment="Top" Width="85" Click="button_Click"/>
            </StackPanel>
            <StackPanel Orientation="Horizontal" Height="72">
                <Button x:Name="buttonSend" Content="Send" HorizontalAlignment="Left" Height="49" Margin="5, 5, 5, 5" VerticalAlignment="Top" Width="75" Click="button_Click"  IsEnabled="False"/>
                <Button x:Name="buttonClearSendText" Content="Clear Recv" HorizontalAlignment="Left" Height="49" Margin="5, 5, 5, 5" VerticalAlignment="Top" Width="95" Click="button_Click" IsEnabled="True"/>
                <Button x:Name="buttonStartRecv" Content="Start Recv" HorizontalAlignment="Left" Height="49" Margin="5, 5, 5, 5" VerticalAlignment="Top" Width="85" Click="button_Click" IsEnabled="False"/>
                <Button x:Name="buttonStopRecv" Content="Stop Recv" HorizontalAlignment="Left" Height="49" Margin="5, 5, 5, 5" VerticalAlignment="Top" Width="90" Click="button_Click" IsEnabled="False"/>
            </StackPanel>
            <ListBox x:Name="ConnectDevices" ItemsSource="{Binding Source={StaticResource PairedDevices}}" Background="Gray" Margin="10" DoubleTapped="ConnectDevices_DoubleTapped" 
                    Width="Auto"
                    Height="Auto"
                    >
                <ListBox.ItemTemplate>
                    <DataTemplate>
                        <TextBlock Text="{Binding Name}" />
                    </DataTemplate>
                </ListBox.ItemTemplate>
            </ListBox>
            <StackPanel Orientation="Horizontal">
                <TextBlock x:Name="SendText" HorizontalAlignment="Left" Height="23" Margin="10" TextWrapping="NoWrap"  Text="Send: " VerticalAlignment="Top" Width="50"/>
                <TextBox x:Name="textBoxSendText" Text="Send Me" HorizontalAlignment="Left" Height="100" Margin="10" TextWrapping="Wrap"  VerticalAlignment="Top" Width="800" ToolTipService.ToolTip="" AcceptsReturn="True"/>
            </StackPanel>
            <StackPanel Orientation="Horizontal">
                <TextBlock x:Name="RecvdText" HorizontalAlignment="Left" Height="23" Margin="10" TextWrapping="NoWrap" Text="Recvd: " VerticalAlignment="Top" Width="50"/>
                <TextBlock x:Name="textBoxRecvdText" Margin="10" TextWrapping="Wrap" Text="Name" Width="800" Height="Auto" 
                            ScrollViewer.HorizontalScrollBarVisibility="Auto"
                            ScrollViewer.VerticalScrollBarVisibility="Visible"
                           ToolTipService.ToolTip=""/>
            </StackPanel>
        </StackPanel>

    </Grid>
</Page>
